<template>
  <div>
    <!-- 搜索 -->
    <TopFilter ref="TopFilterss" :list="topFilterInit" :cols="3" :collapse="collapse" labelWidth="90" @filterChange="changeHandle"></TopFilter>
    <!-- table -->
    <FilterTable ref="table" :columns="columns" :params="fetchParams"  :fetchapi="fetchapi"
      :datakey="'records'" :onColumnsChange="columns => (this.columns = columns)" :onRowSelectChange="selectChange">
      <template slot="controls" slot-scope="props">
        <multiuse-button size="small" type="primary" icon="el-icon-plus" :click="exportFileBtn.bind()">导出</multiuse-button>
      </template>
    </FilterTable>
  </div>
</template>
<script>
import { getListByPage, newSave, piliangqiyong, piliangtingyong, excelExport, editSave ,getCarList} from '@/api/claim/factory/SpecialCarPartTypeWarrantyMaintainOil';
export default {
  //  mixins: [dictionary],
  data() {
    return {
      dataList: [],
      visible: false,
      visibleDrawer: false,
      collapse: false,
      infoId: null,
      fetchapi:getCarList,
      topFilterInit: this.topFilterInitFun(),
      flterValue: {}, //参数
      columns: this.creatHeader(),
      fetchParams: {}, //ipa 接口
      selectedRows: [], //选中经销商
      dialogTitle: '选择车辆',
      visibleAdd: false
    };
  },
  created() {
    // this.dataList = [...res.data.items];
    console.log(this.dataList);
  },
  methods: {
    //搜索数据
    topFilterInitFun() {
      return [
         { type: 'INPUT', label: '车型', fieldName: 'modelId', placeholder: '请输入', initialValue: '' },
         { type: 'SELECT', label: '营运类型', fieldName: 'vpType', placeholder: '请选择', initialValue: '', itemList: [{ text: '保存', value: '1001' }] },
         { type: 'INPUT', label: '保修期', fieldName: 'vpPeriod', placeholder: '请输入', initialValue: '' },
         { type: 'INPUT', label: '保修里程', fieldName: 'vpMile', placeholder: '请输入', initialValue: '' },

      ];
    },
    //搜索获取数据
    changeHandle(val) {
      this.fetchParams = Object.assign({}, this.fetchParams, val);
    },
    //table表头和数据源
    creatHeader() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        { title: '车型', dataIndex: 'partName', sorter: true },
           { title: '营运类型', dataIndex: 'vpType', sorter: true },
            { title: '保修期（月）', dataIndex: 'spPeriod', sorter: true },
              { title: '保修里程（KM）', dataIndex: 'spMile', sorter: true },
                 { title: '创建人', dataIndex: 'createdBy', sorter: true },
                    { title: '创建时间', dataIndex: 'createdAt', sorter: true },
                       { title: '修改人', dataIndex: 'updatedBy', sorter: true },
                          { title: '修改时间', dataIndex: 'updatedAt', sorter: true }

      ];
    },
    // //选中
    // selectChange(rows) {
    //   this.selectedRows = rows;
    //   console.log(this.selectedRows);
    // },
    // close(){
    //   this.visible = false;
    // },
    // chooseOrderNo() {
    //   this.visible = true;
    // },
    // save(obj) {
    //   this.topFilterInit.find(x => x.fieldName == 'model').initialValue = obj[0].address;
    //   this.visible = false;
    // },
    exportFileBtn() {
      this.$refs.TopFilterss.SUBMIT_FORM();
    },
    // add() {
    //   this.visibleAdd = true;
    // },
    // closeAdd() {
    //   this.visibleAdd = false;
    //   this.fetchParams = { ...this.fetchParams };
    // },
    // saveAdd() {
    //   this.visibleAdd = false;
    //   this.fetchParams = { ...this.fetchParams };
    // }
  }
  // mounted() {
  //   this.BaseTable = this.$refs.listModal.$refs.pageTable;
  // }
};
</script>

<style lang="less" scoped></style>
